package adavance.thread;

import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class SleepTest {
    public static void main(String[] args) {
        //当前线程
        System.out.println("每隔5秒，输出一下当前时间：");
        Thread t=new Worker("张庆");
        System.out.println("月薪18.8万，雇了工人干活");
        t.start();
        while (true){
            try {
                System.out.println(new Date());
                Thread.sleep(5999);
                t.interrupt();//喊
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
